/**
 * 获取链接后边的参数
 * @param url 链接 必选
 * @param name  指定某个参数名 可选
 * @returns {*}
 */
export default function (url, name){
	var reg = /(?:\?|&)(.*?)=(.*?)(?=&|$)/g,
		temp,
		res = {};
	while ((temp = reg.exec(url)) != null) res[temp[1]] = decodeURIComponent(temp[2]);
	return name ? res[name] : res;
}